package com.landiao.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.landiao.entities.Shop;
import com.landiao.entities.ShopGrade;
import com.landiao.mapper.ShopGradeMapper;
import com.landiao.mapper.ShopMapper;

@Service
public class ShopService extends BaseService<Shop, String>{
	@Autowired
	private ShopGradeMapper shopGradeMapper;
	@Override
	protected ShopMapper getBaseMapper() {
		// TODO Auto-generated method stub
		return (ShopMapper)baseMapper;
	}
	
	public void updateByPrimaryKeySelective(Shop shop){
		getBaseMapper().updateByPrimaryKeySelective(shop);
	}
	//获取所有门店等级
	public List<ShopGrade> getListshopGrade(ShopGrade shopGrade) {
		// TODO Auto-generated method stub
		return shopGradeMapper.getListshopGrade(shopGrade);
	}
	
	public List<Shop> getSelfAndChildList(String shopId){
		return this.getBaseMapper().selectSelfAndChild(shopId);
	}
	
	/**
	 * 获取企业下所有门店
	 * @param compId
	 * @return
	 */
	public List<Shop> getShopListByCompId(String compId){
		Shop shop = new Shop();
		shop.setCompId(compId);
		return this.getBaseMapper().queryByPage(shop, null);
	}
}
